[Java][microprofile] generate a Gradle build#24291
Conversation
The microprofile library clears the supporting files provided by the common Java client codegen, which dropped the Gradle build along with them. As a result the samples only ever had a pom.xml, and the Gradle step of the Java client CI job had to be guarded to skip them. Add a microprofile build.gradle template mirroring the dependencies of the two pom templates (JSON-B/Jackson, MicroProfile Rest Client 2.0/3.0, mutiny, XML, bean validation) and re-register the shared Gradle supporting files, as every other Java client library already does. The guard in the JDK17 workflow is no longer needed.
There was a problem hiding this comment.
29 issues found across 107 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="samples/client/petstore/java/microprofile-rest-client-3.0-jackson-mutiny/gradle/wrapper/gradle-wrapper.properties">
<violation number="1" location="samples/client/petstore/java/microprofile-rest-client-3.0-jackson-mutiny/gradle/wrapper/gradle-wrapper.properties:3">
P2: A first-time `./gradlew` download executes Gradle without archive-integrity verification, so a replaced hosted distribution would be accepted. Pin the official 8.7 binary checksum in the wrapper properties.</violation>
</file>
<file name="samples/client/petstore/java/microprofile-rest-client-outer-enum/build.gradle">
<violation number="1" location="samples/client/petstore/java/microprofile-rest-client-outer-enum/build.gradle:74">
P2: JUnit 5 test classes will not execute because `junit-jupiter-api` supplies annotations/assertions but no JUnit Platform engine. Add the Jupiter engine to the test runtime classpath so `gradlew test` actually discovers generated tests.</violation>
</file>
<file name="samples/client/petstore/java/microprofile-rest-client-3.0-jackson-ignore-case/gradle/wrapper/gradle-wrapper.properties">
<violation number="1" location="samples/client/petstore/java/microprofile-rest-client-3.0-jackson-ignore-case/gradle/wrapper/gradle-wrapper.properties:3">
P2: First wrapper invocation executes an unpinned remote Gradle distribution, so a compromised or substituted download is accepted. Pin the published distribution SHA-256 to make the wrapper reject altered archives.</violation>
</file>
<file name="samples/client/petstore/java/microprofile-oneof-sealed/build.gradle">
<violation number="1" location="samples/client/petstore/java/microprofile-oneof-sealed/build.gradle:74">
P2: The Gradle test runtime contains only the JUnit API, not a Jupiter TestEngine, so `useJUnitPlatform()` cannot discover or execute `DefaultApiTest` (or generated tests added later). Include the Jupiter aggregate/engine and platform launcher in the test dependencies.</violation>
</file>
<file name="samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/build.gradle">
<violation number="1" location="samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/build.gradle:77">
P2: `gradlew test` has no JUnit Jupiter engine, so generated JUnit 5 tests cannot be discovered/executed. Include `junit-jupiter-engine` at test runtime (or depend on the `junit-jupiter` aggregate).</violation>
</file>
<file name="samples/client/petstore/java/microprofile-rest-client-3.0-jackson-mutiny/build.gradle">
<violation number="1" location="samples/client/petstore/java/microprofile-rest-client-3.0-jackson-mutiny/build.gradle:76">
P2: `gradlew test` cannot launch these JUnit 5 tests because the runtime classpath has the API but no Jupiter test engine. Add `junit-jupiter-engine` as a test runtime dependency.</violation>
</file>
<file name="samples/client/petstore/java/microprofile-rest-client-3.0-jackson-ignore-case/build.gradle">
<violation number="1" location="samples/client/petstore/java/microprofile-rest-client-3.0-jackson-ignore-case/build.gradle:51">
P3: Unused version variables in the `ext` block: `jakarta_json_bind_version`, `jakarta_json_version`, `jakarta_xml_bind_version`, and `jaxb_version` are defined but never referenced in any dependency declaration in this build file. These are carry-overs from the non-Jackson JSON-B variant that are not needed here. Consider removing them to avoid confusion about which dependencies are actually used.</violation>
<violation number="2" location="samples/client/petstore/java/microprofile-rest-client-3.0-jackson-ignore-case/build.gradle:77">
P2: `gradlew test` has no JUnit Jupiter TestEngine, so the generated `@Test` methods cannot run. Add the Jupiter engine to the test runtime classpath, matching the other Java Gradle templates.</violation>
</file>
<file name="samples/client/petstore/java/microprofile-rest-client-3.0/build.gradle">
<violation number="1" location="samples/client/petstore/java/microprofile-rest-client-3.0/build.gradle:13">
P3: A build run on a newer JDK can compile calls to post-Java-11 APIs while emitting Java 11 bytecode, causing runtime linkage failures on Java 11. Set `options.release = 11` for the generated Java 11 target.</violation>
<violation number="2" location="samples/client/petstore/java/microprofile-rest-client-3.0/build.gradle:20">
P2: `publish` omits the sources and Javadoc JARs: `archives` does not add them to this `MavenPublication`, whose only input is `components.java`. Configure source/Javadoc variants on `java` (or explicitly attach both tasks to `maven`) before publishing.</violation>
<violation number="3" location="samples/client/petstore/java/microprofile-rest-client-3.0/build.gradle:74">
P2: `./gradlew test` cannot execute the generated Jupiter tests because the runtime classpath has the API but no Jupiter TestEngine (or Platform launcher). Use the Jupiter aggregate and add the JUnit Platform launcher as a test runtime dependency.</violation>
</file>
<file name="samples/client/petstore/java/microprofile-rest-client-3.0-jackson/build.gradle">
<violation number="1" location="samples/client/petstore/java/microprofile-rest-client-3.0-jackson/build.gradle:20">
P3: `publish` will omit the sources and Javadoc artifacts: `archives` does not attach these tasks to the `MavenPublication`. Attach both tasks to `maven` (or use `java { withSourcesJar(); withJavadocJar() }`) so published clients include the artifacts this build creates.</violation>
<violation number="2" location="samples/client/petstore/java/microprofile-rest-client-3.0-jackson/build.gradle:51">
P3: Unused version variables in the `ext` block: `jakarta_json_bind_version`, `jakarta_json_version`, `jakarta_xml_bind_version`, and `jaxb_version` are defined but never referenced in any dependency declaration in this build file. These are carry-overs from the non-Jackson JSON-B variant that are not needed here. Consider removing them to avoid confusion about which dependencies are actually used.</violation>
<violation number="3" location="samples/client/petstore/java/microprofile-rest-client-3.0-jackson/build.gradle:77">
P2: Gradle has no JUnit Jupiter engine to discover the generated `@Test` methods, so `test` can complete without executing this suite. Add `junit-jupiter-engine` at test runtime (or depend on the `junit-jupiter` aggregate).</violation>
</file>
<file name="samples/client/petstore/java/microprofile-rest-client-mutiny/build.gradle">
<violation number="1" location="samples/client/petstore/java/microprofile-rest-client-mutiny/build.gradle:76">
P1: A normal Gradle build fails during test compilation, so this generated client only builds when tests are skipped. Mirror the MicroProfile test runtime dependencies from the POM; include the JUnit engine as well so `useJUnitPlatform()` can execute the generated tests.</violation>
<violation number="2" location="samples/client/petstore/java/microprofile-rest-client-mutiny/build.gradle:76">
P1: The `junit-jupiter-engine` runtime dependency is needed for tests to actually execute with `useJUnitPlatform()`. Without it, no test engine is discovered and zero tests run.
Add this below the existing test dependency:
```groovy
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
```</violation>
</file>
<file name="samples/client/petstore/java/microprofile-rest-client-3.0-mutiny/build.gradle">
<violation number="1" location="samples/client/petstore/java/microprofile-rest-client-3.0-mutiny/build.gradle:20">
P2: `publish` omits the source and Javadoc JARs even though this build creates them. Attach `sourcesJar` and `javadocJar` to the `MavenPublication` (after those tasks are declared) so published generated clients retain those artifacts.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/Java/libraries/microprofile/build.gradle.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/Java/libraries/microprofile/build.gradle.mustache:111">
P1: MicroProfile 1.x/2.0 clients with `useBeanValidation=true` fail compilation: generated sources import `javax.validation`, but this dependency resolves Bean Validation 3 under `jakarta.validation`. Select the javax Validation API for the non-`microprofile3` branch.</violation>
<violation number="2" location="modules/openapi-generator/src/main/resources/Java/libraries/microprofile/build.gradle.mustache:144">
P2: Generated JUnit tests have no Jupiter engine at runtime, so Gradle cannot execute them under `useJUnitPlatform()`. Add `junit-jupiter-engine` to `testRuntimeOnly`, matching the shared Java build template.</violation>
</file>
<file name="samples/client/petstore/java/microprofile-oneof-interface/build.gradle">
<violation number="1" location="samples/client/petstore/java/microprofile-oneof-interface/build.gradle:20">
P2: The Gradle artifact omits the Jandex index Maven builds produce, so Quarkus consumers will not automatically scan this dependency and `DefaultApi` will not be available for CDI rest-client injection. Configure equivalent Jandex indexing before packaging/publishing.</violation>
<violation number="2" location="samples/client/petstore/java/microprofile-oneof-interface/build.gradle:41">
P3: `publish` will omit the source and Javadoc JARs: adding them to `archives` does not attach them to `MavenPublication`. Add source/Javadoc variants to the Java component or explicitly attach both artifacts to `maven`.</violation>
<violation number="3" location="samples/client/petstore/java/microprofile-oneof-interface/build.gradle:74">
P2: `gradlew test` will not execute the generated JUnit 5 tests because this declares only the API, not a Jupiter engine. Add the engine as a test runtime dependency, matching other Java Gradle samples.</violation>
</file>
<file name="samples/server/petstore/java-microprofile/build.gradle">
<violation number="1" location="samples/server/petstore/java-microprofile/build.gradle:51">
P3: Four `ext` properties in `build.gradle` are defined but never referenced (`jakarta_json_bind_version`, `jakarta_json_version`, `jakarta_xml_bind_version`, `jaxb_version`). Since this generated sample doesn't include dependencies for JSON-B, Jakarta JSON, or JAXB, these properties serve no purpose in this build file. Consider removing them or adding the corresponding dependencies if they are needed.</violation>
<violation number="2" location="samples/server/petstore/java-microprofile/build.gradle:76">
P2: Once a JUnit engine is present, every API test fails during `@BeforeEach` because the Gradle test runtime lacks a `RestClientBuilderResolver` implementation. Mirror the POM's SmallRye test dependencies in this generated build configuration.</violation>
<violation number="3" location="samples/server/petstore/java-microprofile/build.gradle:76">
P2: `gradlew test` has no JUnit Jupiter engine, so the generated `@Test` methods are not executed. Add `junit-jupiter` or `junit-jupiter-engine` as a test runtime dependency (in the template as well, so regeneration preserves it).</violation>
</file>
<file name="samples/client/petstore/java/microprofile-rest-client/build.gradle">
<violation number="1" location="samples/client/petstore/java/microprofile-rest-client/build.gradle:13">
P2: Generated builds fail on non-UTF-8 locales because generated sources contain UTF-8 text but compilation uses the platform default encoding. Configure Java compilation and Javadoc for UTF-8.</violation>
<violation number="2" location="samples/client/petstore/java/microprofile-rest-client/build.gradle:14">
P3: This assignment uses `JavaPluginConvention`, deprecated in Gradle 8.7 and removed in Gradle 9. Use the `java { sourceCompatibility ...; targetCompatibility ... }` extension so generated builds remain upgradeable.</violation>
<violation number="3" location="samples/client/petstore/java/microprofile-rest-client/build.gradle:74">
P1: `gradlew test` cannot compile the generated API tests: their `RestClientBuilder` setup needs JAX-RS, which `compileOnly` does not expose to test compilation. Mirror the POM's SmallRye/JAX-RS test classpath and add a JUnit engine so these tests can run.</violation>
</file>
<file name="samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/build.gradle">
<violation number="1" location="samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/build.gradle:74">
P1: Tests will silently pass with zero executions because the JUnit Jupiter engine is not on the test runtime classpath. The `testImplementation` declaration for `junit-jupiter-api` only provides the API (annotations, assertions) but not the engine that discovers and runs `@Test` methods. Calling `gradlew test` will output "0 tests found" and succeed, giving a false sense of test coverage.
Add the engine as a `testRuntimeOnly` dependency to enable actual test execution.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_jaxrs_version" | ||
| implementation "io.smallrye.reactive:mutiny:$mutiny_version" | ||
|
|
||
| testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" |
There was a problem hiding this comment.
P1: A normal Gradle build fails during test compilation, so this generated client only builds when tests are skipped. Mirror the MicroProfile test runtime dependencies from the POM; include the JUnit engine as well so useJUnitPlatform() can execute the generated tests.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/microprofile-rest-client-mutiny/build.gradle, line 76:
<comment>A normal Gradle build fails during test compilation, so this generated client only builds when tests are skipped. Mirror the MicroProfile test runtime dependencies from the POM; include the JUnit engine as well so `useJUnitPlatform()` can execute the generated tests.</comment>
<file context>
@@ -0,0 +1,81 @@
+ implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_jaxrs_version"
+ implementation "io.smallrye.reactive:mutiny:$mutiny_version"
+
+ testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
+}
+
</file context>
| compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" | ||
| {{#useBeanValidation}} | ||
| // Bean Validation API support | ||
| compileOnly "jakarta.validation:jakarta.validation-api:$beanvalidation_version" |
There was a problem hiding this comment.
P1: MicroProfile 1.x/2.0 clients with useBeanValidation=true fail compilation: generated sources import javax.validation, but this dependency resolves Bean Validation 3 under jakarta.validation. Select the javax Validation API for the non-microprofile3 branch.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/resources/Java/libraries/microprofile/build.gradle.mustache, line 111:
<comment>MicroProfile 1.x/2.0 clients with `useBeanValidation=true` fail compilation: generated sources import `javax.validation`, but this dependency resolves Bean Validation 3 under `jakarta.validation`. Select the javax Validation API for the non-`microprofile3` branch.</comment>
<file context>
@@ -0,0 +1,149 @@
+ compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
+ {{#useBeanValidation}}
+ // Bean Validation API support
+ compileOnly "jakarta.validation:jakarta.validation-api:$beanvalidation_version"
+ {{/useBeanValidation}}
+ {{#useBeanValidationFeature}}
</file context>
| implementation "jakarta.activation:jakarta.activation-api:$jakarta_activation_version" | ||
| implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_jaxrs_version" | ||
|
|
||
| testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" |
There was a problem hiding this comment.
P1: gradlew test cannot compile the generated API tests: their RestClientBuilder setup needs JAX-RS, which compileOnly does not expose to test compilation. Mirror the POM's SmallRye/JAX-RS test classpath and add a JUnit engine so these tests can run.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/microprofile-rest-client/build.gradle, line 74:
<comment>`gradlew test` cannot compile the generated API tests: their `RestClientBuilder` setup needs JAX-RS, which `compileOnly` does not expose to test compilation. Mirror the POM's SmallRye/JAX-RS test classpath and add a JUnit engine so these tests can run.</comment>
<file context>
@@ -0,0 +1,79 @@
+ implementation "jakarta.activation:jakarta.activation-api:$jakarta_activation_version"
+ implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_jaxrs_version"
+
+ testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
+}
+
</file context>
| implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_jaxrs_version" | ||
| implementation "io.smallrye.reactive:mutiny:$mutiny_version" | ||
|
|
||
| testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" |
There was a problem hiding this comment.
P1: The junit-jupiter-engine runtime dependency is needed for tests to actually execute with useJUnitPlatform(). Without it, no test engine is discovered and zero tests run.
Add this below the existing test dependency:
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/microprofile-rest-client-mutiny/build.gradle, line 76:
<comment>The `junit-jupiter-engine` runtime dependency is needed for tests to actually execute with `useJUnitPlatform()`. Without it, no test engine is discovered and zero tests run.
Add this below the existing test dependency:
```groovy
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
```</comment>
<file context>
@@ -0,0 +1,81 @@
+ implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_jaxrs_version"
+ implementation "io.smallrye.reactive:mutiny:$mutiny_version"
+
+ testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
+}
+
</file context>
| implementation "jakarta.activation:jakarta.activation-api:$jakarta_activation_version" | ||
| implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_jaxrs_version" | ||
|
|
||
| testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" |
There was a problem hiding this comment.
P1: Tests will silently pass with zero executions because the JUnit Jupiter engine is not on the test runtime classpath. The testImplementation declaration for junit-jupiter-api only provides the API (annotations, assertions) but not the engine that discovers and runs @Test methods. Calling gradlew test will output "0 tests found" and succeed, giving a false sense of test coverage.
Add the engine as a testRuntimeOnly dependency to enable actual test execution.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/build.gradle, line 74:
<comment>Tests will silently pass with zero executions because the JUnit Jupiter engine is not on the test runtime classpath. The `testImplementation` declaration for `junit-jupiter-api` only provides the API (annotations, assertions) but not the engine that discovers and runs `@Test` methods. Calling `gradlew test` will output "0 tests found" and succeed, giving a false sense of test coverage.
Add the engine as a `testRuntimeOnly` dependency to enable actual test execution.</comment>
<file context>
@@ -0,0 +1,79 @@
+ implementation "jakarta.activation:jakarta.activation-api:$jakarta_activation_version"
+ implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_jaxrs_version"
+
+ testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
+}
+
</file context>
| testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" | |
| testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" | |
| testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" |
| } | ||
|
|
||
| artifacts { | ||
| archives sourcesJar |
There was a problem hiding this comment.
P3: publish will omit the source and Javadoc JARs: adding them to archives does not attach them to MavenPublication. Add source/Javadoc variants to the Java component or explicitly attach both artifacts to maven.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/microprofile-oneof-interface/build.gradle, line 41:
<comment>`publish` will omit the source and Javadoc JARs: adding them to `archives` does not attach them to `MavenPublication`. Add source/Javadoc variants to the Java component or explicitly attach both artifacts to `maven`.</comment>
<file context>
@@ -0,0 +1,79 @@
+}
+
+artifacts {
+ archives sourcesJar
+ archives javadocJar
+}
</file context>
| } | ||
|
|
||
| sourceCompatibility = JavaVersion.VERSION_1_8 | ||
| targetCompatibility = JavaVersion.VERSION_1_8 |
There was a problem hiding this comment.
P3: This assignment uses JavaPluginConvention, deprecated in Gradle 8.7 and removed in Gradle 9. Use the java { sourceCompatibility ...; targetCompatibility ... } extension so generated builds remain upgradeable.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/microprofile-rest-client/build.gradle, line 14:
<comment>This assignment uses `JavaPluginConvention`, deprecated in Gradle 8.7 and removed in Gradle 9. Use the `java { sourceCompatibility ...; targetCompatibility ... }` extension so generated builds remain upgradeable.</comment>
<file context>
@@ -0,0 +1,79 @@
+}
+
+sourceCompatibility = JavaVersion.VERSION_1_8
+targetCompatibility = JavaVersion.VERSION_1_8
+
+publishing {
</file context>
| jackson_version = "2.17.1" | ||
| jakarta_activation_version = "2.1.0" | ||
| jakarta_annotation_version = "2.0.0" | ||
| jakarta_json_bind_version = "3.0.0" |
There was a problem hiding this comment.
P3: Unused version variables in the ext block: jakarta_json_bind_version, jakarta_json_version, jakarta_xml_bind_version, and jaxb_version are defined but never referenced in any dependency declaration in this build file. These are carry-overs from the non-Jackson JSON-B variant that are not needed here. Consider removing them to avoid confusion about which dependencies are actually used.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/microprofile-rest-client-3.0-jackson-ignore-case/build.gradle, line 51:
<comment>Unused version variables in the `ext` block: `jakarta_json_bind_version`, `jakarta_json_version`, `jakarta_xml_bind_version`, and `jaxb_version` are defined but never referenced in any dependency declaration in this build file. These are carry-overs from the non-Jackson JSON-B variant that are not needed here. Consider removing them to avoid confusion about which dependencies are actually used.</comment>
<file context>
@@ -0,0 +1,82 @@
+ jackson_version = "2.17.1"
+ jakarta_activation_version = "2.1.0"
+ jakarta_annotation_version = "2.0.0"
+ jakarta_json_bind_version = "3.0.0"
+ jakarta_json_version = "2.0.1"
+ jakarta_ws_rs_version = "3.0.0"
</file context>
| jackson_version = "2.17.1" | ||
| jakarta_activation_version = "2.1.0" | ||
| jakarta_annotation_version = "2.0.0" | ||
| jakarta_json_bind_version = "3.0.0" |
There was a problem hiding this comment.
P3: Unused version variables in the ext block: jakarta_json_bind_version, jakarta_json_version, jakarta_xml_bind_version, and jaxb_version are defined but never referenced in any dependency declaration in this build file. These are carry-overs from the non-Jackson JSON-B variant that are not needed here. Consider removing them to avoid confusion about which dependencies are actually used.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/microprofile-rest-client-3.0-jackson/build.gradle, line 51:
<comment>Unused version variables in the `ext` block: `jakarta_json_bind_version`, `jakarta_json_version`, `jakarta_xml_bind_version`, and `jaxb_version` are defined but never referenced in any dependency declaration in this build file. These are carry-overs from the non-Jackson JSON-B variant that are not needed here. Consider removing them to avoid confusion about which dependencies are actually used.</comment>
<file context>
@@ -0,0 +1,82 @@
+ jackson_version = "2.17.1"
+ jakarta_activation_version = "2.1.0"
+ jakarta_annotation_version = "2.0.0"
+ jakarta_json_bind_version = "3.0.0"
+ jakarta_json_version = "2.0.1"
+ jakarta_ws_rs_version = "3.0.0"
</file context>
| jackson_version = "2.17.1" | ||
| jakarta_activation_version = "1.2.2" | ||
| jakarta_annotation_version = "1.3.5" | ||
| jakarta_json_bind_version = "1.0.2" |
There was a problem hiding this comment.
P3: Four ext properties in build.gradle are defined but never referenced (jakarta_json_bind_version, jakarta_json_version, jakarta_xml_bind_version, jaxb_version). Since this generated sample doesn't include dependencies for JSON-B, Jakarta JSON, or JAXB, these properties serve no purpose in this build file. Consider removing them or adding the corresponding dependencies if they are needed.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/java-microprofile/build.gradle, line 51:
<comment>Four `ext` properties in `build.gradle` are defined but never referenced (`jakarta_json_bind_version`, `jakarta_json_version`, `jakarta_xml_bind_version`, `jaxb_version`). Since this generated sample doesn't include dependencies for JSON-B, Jakarta JSON, or JAXB, these properties serve no purpose in this build file. Consider removing them or adding the corresponding dependencies if they are needed.</comment>
<file context>
@@ -0,0 +1,81 @@
+ jackson_version = "2.17.1"
+ jakarta_activation_version = "1.2.2"
+ jakarta_annotation_version = "1.3.5"
+ jakarta_json_bind_version = "1.0.2"
+ jakarta_json_version = "1.1.6"
+ jakarta_ws_rs_version = "2.1.6"
</file context>
The
microprofilelibrary callssupportingFiles.clear()to drop the extra files added by the common Java client codegen, which also discards the Gradle build (build.gradle,settings.gradle,gradle.properties,gradlew,gradlew.batand the wrapper). The samples therefore only ever contained apom.xml, and the Gradle step of the Java client CI job had to be guarded to skip them, so the generated code was never compiled by Gradle.This adds a
build.gradletemplate formicroprofileand re-registers the shared Gradle supporting files, following the same pattern as every other Java client library (each ships its ownlibraries/<lib>/build.gradle.mustacheand inherits the rest from the commonJavatemplates).Java/libraries/microprofile/build.gradle.mustachemirrors the dependencies of the two pom templates: JSON-B / Jackson, MicroProfile Rest Client 2.0 (javax) and 3.0 (jakarta), mutiny, XML and bean validation. The Java release follows the poms (17 whenuseSealedOneOfInterfacesis set, otherwise 11 for MP 3.0 and 1.8 for MP 2.0).samples-java-client-jdk17.yamlis removed, somicroprofile-oneof-sealedis now built with Gradle like the other samples.All 13 regenerated microprofile samples (12 clients +
samples/server/petstore/java-microprofile, which shares the same code path) were verified locally withgradlew build -x test: the sealed sample on JDK 17 and the remaining ones on JDK 11.JavaClientCodegenTestpasses (262 tests).PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
Summary by cubic
Adds Gradle build generation for the Java
microprofilelibrary and enables Gradle builds for all MicroProfile samples in CI. This bringsmicroprofilein line with other Java clients and ensures the code is compiled with Gradle.New Features
build.gradleformicroprofilemirroring existing POMs: JSON‑B/Jackson, MicroProfile Rest Client 2.0 (javax) and 3.0 (jakarta), Mutiny, XML, and Bean Validation.useSealedOneOfInterfacesis enabled; otherwise 11 for MP 3.0 and 1.8 for MP 2.0.JavaClientCodegen(build.gradle,settings.gradle,gradle.properties,gradlew, wrapper).Refactors
samples-java-client-jdk17.yaml; MicroProfile samples now build with Gradle like the rest.Written for commit a86e2dd. Summary will update on new commits.